Install .NET Core 2.0
2017/09/25 |
Install Microsoft .NET Core 2.0 for Linux.
|
|
[1] | Install .NET Core 2.0. |
[root@dlp ~]#
[root@dlp ~]# yum -y install deltarpm unzip zlib gettext libunwind libicu libcurl-devel openssl-devel libicu-devel rpm --import https://packages.microsoft.com/keys/microsoft.asc
[root@dlp ~]#
cat > /etc/yum.repos.d/dotnetdev.repo <<EOF
[packages-microsoft-com-prod] name=packages-microsoft-com-prod baseurl=https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc EOF
[root@dlp ~]#
[root@dlp ~]# yum -y install dotnet-sdk-2.0.0 echo 'export PATH=$PATH:$HOME/dotnet' > /etc/profile.d/dotnetdev.sh [root@dlp ~]# source /etc/profile.d/dotnetdev.sh [root@dlp ~]# dotnet --version 2.0.0 |
[2] | Run sample console application for test with a common user. |
[cent@dlp ~]$ dotnet new console -o helloworld Welcome to .NET Core! --------------------- Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs. Telemetry -------------- The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell. You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry. Getting ready... The template "Console Application" was created successfully. Processing post-creation actions... Running 'dotnet restore' on helloworld/helloworld.csproj... Restoring packages for /home/cent/helloworld/helloworld.csproj... Generating MSBuild file /home/cent/helloworld/obj/helloworld.csproj.nuget.g.props. Generating MSBuild file /home/cent/helloworld/obj/helloworld.csproj.nuget.g.targets. Restore completed in 204.13 ms for /home/cent/helloworld/helloworld.csproj. Restore succeeded.[cent@dlp ~]$ cd helloworld [cent@dlp helloworld]$ dotnet run Hello World! |
[3] | Run sample ASP.NET Core Web application for test with a common user. |
[cent@dlp ~]$ dotnet new razor -o asp.net The template "ASP.NET Core Web App" was created successfully. This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details. Processing post-creation actions... Running 'dotnet restore' on asp.net/asp.net.csproj... Restoring packages for /home/cent/asp.net/asp.net.csproj... Restoring packages for /home/cent/asp.net/asp.net.csproj... Restore completed in 756.03 ms for /home/cent/asp.net/asp.net.csproj. Generating MSBuild file /home/cent/asp.net/obj/asp.net.csproj.nuget.g.props. Generating MSBuild file /home/cent/asp.net/obj/asp.net.csproj.nuget.g.targets. Restore completed in 2.42 sec for /home/cent/asp.net/asp.net.csproj. Restore succeeded.[cent@dlp ~]$ cd asp.net [cent@dlp asp.net]$ dotnet run Hosting environment: Production Content root path: /home/cent/asp.net Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. |
Access to [http://localhost:5000], then following page is shown. |